% input=imread('Berea_Final_Pattern.bmp','bmp');
% input=input/255;

input=imread('Inc4_b.bmp','bmp');
%input=double(input(:,:,2))/255;

input=-1*input+1;
input=input';

[lx,ly]=size(input);
lyori=ly;
A=zeros(lx,ly/2);
input=[input,A];

lz=7;
[lx,ly]=size(input);

fid = fopen('Emily_BC4.dat','wt');

for k=1:lz
    for j=1:ly
        for i=1:lx+2
            
        if ((i==1) || (i==lx+2) ||(k==1) ||(k==lz))
            if(j<=lyori)
            fprintf(fid,'%1d\n',1);
            else
                fprintf(fid,'%1d\n',0);
            end
        else
        fprintf(fid,'%1d\n',input(i-1,j));
        end
        
        end
    end
    k
end

lyori

lx+2
ly
lz
